#ifndef QFRAMEDIRSBROWSER_H
#define QFRAMEDIRSBROWSER_H

#include <QWidget>
#include <QTreeView>
#include <QListView>
#include <QFileSystemModel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QComboBox>
#include <QLabel>
#include <QDir>
#include <QSortFilterProxyModel>
#include "../../../MACRO.h"
namespace Ui {
class QFrameDirsBrowser;
}

class QFrameDirsBrowser : public QWidget
{
    Q_OBJECT

public:
    explicit QFrameDirsBrowser(QWidget *parent = nullptr);
    ~QFrameDirsBrowser();

private:
    Ui::QFrameDirsBrowser *ui;

public slots:
    void onPathChanged(const QString &path);
    QStringList getAllFilePath(QString,int);
    void onGoClicked();
    void onBackClicked();
    void onForwardClicked();
    void onUpClicked();
    void onViewModeChanged(int index);
    void onCurrentIndexChanged(const QModelIndex &index);

private:
    QFileSystemModel *fileSystemModel;
    QSortFilterProxyModel *proxyModel;
    QTreeView *treeView;
    QListView *listView;
    QLineEdit *pathEdit;
    QPushButton *goButton;
    QPushButton *backButton;
    QPushButton *forwardButton;
    QPushButton *upButton;
    QComboBox *viewModeCombo;
    QLabel *statusLabel;

    QStringList navigationHistory;
    int historyIndex;

    void updateStatusBar();
    QString work_path;
    void findFiles(const QString &currentDir, const QString type, QFileInfoList &result);

};

#endif // QFRAMEDIRSBROWSER_H
